@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>功能测试管理</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="row">
							<div>
								<!-- <#NameCon id="condition" name="名称" />
								</div>
								 -->
								<div class="col-sm-8">
	                            @if(shiro.hasPermission("/test/add")){
	                                <#button class='btn btn-info' name="新增" icon="fa-plus" clickFun="Test.openAddTest()"/>
	                            @}							
								</div>
								<div class="col-sm-4">						
			                        <div class="hidden-xs pull-right" id="TestTableToolbar" role="group">
			                            @if(shiro.hasPermission("/test/Export2Excel")){
			                                <#button class='btn btn-info' name="导出Excel" icon="fa-file-excel-o" clickFun="Export2Excel($('#TestGrid'))" space="true"/>
			                            @}
										<button type="button" aria-label="columns" class="btn btn-info" title="显示/显示过滤器" onclick="filterToolbar()">
											<i class="glyphicon glyphicon-search"></i><span>过滤记录</span>
										</button>			                            
										<button type="button" aria-label="columns" class="btn btn-info btn-outline dropdown-toggle" data-toggle="dropdown" title="隐藏显示列" onclick="columnSelector($('#TestGrid'))">
											<i class="glyphicon glyphicon-list"></i><span class="caret"></span>
										</button>			                            
				                        <form action="${ctxPath}/test/Export2Excel" method="post" id="export2excel">
				                        	<input type="hidden" name="export2excel_params" id="export2excel_params">
				                        </form>
			                        </div>
		                        </div>
							</div>
                    	</div>
						<div class="row">
	                        <table id="TestGrid" />
	                        <div id="TestPager"></div>                        
						</div>
		            </div>
		        </div>
	        </div>
	    </div>
	</div>
<script>
	$.jgrid.defaults.width = 780;
	$.jgrid.defaults.responsive = true;
	$.jgrid.defaults.styleUI = 'Bootstrap';

	//controller输出select列表格式: :;值1:描述1;值2:描述2
	//注意最前面有个;
	//	如：:;0:否;1:是 
	var select_var_fdSelect = '${select_var_fdSelect}'; //请在相应controller输出此变量或自定义
	var select_var_fdSelect2 = '${select_var_fdSelect2}'; //请在相应controller输出此变量或自定义

	$(document).ready(function () {
		$("#TestGrid").jqGrid({
			url: '${ctxPath}/test/list',
			mtype: "GET",
			styleUI : 'Bootstrap',
			datatype: "json",
			colModel: [
	            @if(shiro.hasPermission("/test/update")||shiro.hasPermission("/test/delete")){
				{ label: '操作', name:'_act_', index:'', width:63, sortable:false, search: false, resizable: false, fixed:true},
				@}
				{ label: '', name: 'id', index: 'id', key: true, hidden: true, width: 100, search: true, resizable: true, fixed: true, align: 'right', sortable: true, editable: false
						, searchoptions: {sopt: ["ge","gt","le","lt","ne"]}},
				{ label: '名称', name: 'fdName', index: 'fdName', hidden: false, width: 100, search: true, resizable: true, fixed: true, align: 'left', sortable: true, editable: false
						, searchoptions: {sopt: ["cn","eq","nc"]}},
				{ label: '日期型数据', name: 'fdDate', index: 'fdDate', hidden: false, width: 100, search: true, resizable: true, fixed: true, align: 'center', sortable: true, editable: false
						, searchoptions: {sopt: ["eq","ge","le","ne"], dataInit: datePick, attr:{title:'选择日期'}}},
				{ label: 'BIT数据', name: 'fdBit', index: 'fdBit', hidden: false, width: 30, search: true, resizable: true, fixed: true, align: 'center', sortable: true, editable: false, stype:'select', edittype: 'checkbox', formatter: 'checkbox'
						, searchoptions: {sopt: ["eq"], value: '1:是;0:否'}, 
						editoptions: { value: '1:0', defaultValue: '1'}},
				{ label: '单选', name: 'fdSelect', index: 'fdSelect', hidden: false, width: 100, search: true, resizable: true, fixed: true, align: 'left', sortable: true, editable: false, stype:'select', edittype: 'select', formatter: 'select', multiple: false
						, searchoptions: {sopt: ["eq","cn","nc"], value: ":;" + select_var_fdSelect}, 
						editoptions: { multiple: false, value: select_var_fdSelect}},
				{ label: '多选', name: 'fdSelect2', index: 'fdSelect2', hidden: false, width: 100, search: true, resizable: true, fixed: true, align: 'left', sortable: true, editable: false, stype:'select', edittype: 'select', formatter: 'select', multiple: true
						, searchoptions: {sopt: ["cn","nc"], value: ":;" + select_var_fdSelect2}, 
						editoptions: { multiple: true, value: select_var_fdSelect2}},
			],
			cmTemplate: {autoResizable:false},
			footerrow: false,
			viewrecords: true,
			autowidth : true,
			height: 'auto',
			pager: "#TestPager",
			rowList: [10, 20, 50],
			rowNum: 10,
			rownumbers: true,
			loadonce: false,
			caption: "功能测试管理",
			multiselect: false,
			storeNavOptions: false,
			navOptions: {	
				reloadGridOptions: { fromServer: true }, 
			},
			gridComplete : function() {
				var ids = $("#TestGrid").jqGrid('getDataIDs');
				for (var i = 0; i < ids.length; i++) {
					var rowId = ids[i];
					var rowData = $('#TestGrid').jqGrid('getRowData',rowId);
					var info=''; be=''; ca='';
					//info = "<button class='btn btn-info btn-xs' title='查看'  onclick=\"Test.openTestView('" + rowData.id + "');\"><i class='fa fa-info-circle'></i></button>&nbsp";
		            @if(shiro.hasPermission("/test/update")){
					be = "<button class='btn btn-primary btn-xs' title='编辑'  onclick=\"Test.openTestDetail('" + rowData.id + "');\"><i class='fa fa-pencil'></i></button>&nbsp";
					@}
		            @if(shiro.hasPermission("/test/delete")){
					ca = "<button class='btn btn-danger btn-xs' title='删除'  onclick=\"Test.delete('" + rowData.brandId + "');\"><i class='fa fa-times'></i></button>";
					@}
					jQuery("#TestGrid").jqGrid('setRowData', ids[i], {
						_act_ :  info + be + ca 
					});
				};
				$("#gview_TestGrid > .ui-jqgrid-titlebar").hide(); 	//隐藏caption
				//$('#gsh_TestGrid__act_').html('<div class="btn btn-info btn-sm" icon="fa-search" onclick="$(\'#TestGrid\').jqGrid().searchGrid()">查询条件:</div>');
				filterToolbar();	//隐藏过滤器
				loadColState($("#TestGrid"));	//加载列设置
			},
			ondblClickRow:function(row){
				var rowData = $('#TestGrid').jqGrid('getRowData',row);
				Test.openTestView(rowData.id);
			},
	        resizeStop: function () {
				saveColState($("#TestGrid"));
	        },
			
	    })
	    .navGrid('#TestPager', {edit:false,
	    	add:false,
	    	del:false,
	    	search:true,
	    	refresh:true
	    })
		.searchGrid({multipleSearch:true, sopt: ['cn','eq','ne','le','ge'], showQuery: false}); //定义查询可用的操作符(全局)
		
		$("#searchmodfbox_TestGrid").find(".ui-jqdialog-titlebar-close").click();//初始化时关闭多条件查询
		//激活头部过滤条件
		$('#TestGrid').jqGrid('filterToolbar',{defaultSearch:'cn',stringResult: true,searchOnEnter : true, searchOperators: true});
		
		
		$(function(){
			$(window).resize(function(){   
				loadColState($("#TestGrid"));
			}); 
		});	
		
	});
</script>
<script src="${ctxPath}/static/modular/biz/test/test.js"></script>
@}

